package com.wlsk.license.config;

import com.wlsk.license.helper.FeignLogger;
import feign.Logger;
import org.springframework.cloud.openfeign.FeignLoggerFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class FeignConf implements FeignLoggerFactory {

    private Logger logger;

    public FeignConf() {
    }

    public FeignConf(Logger logger) {
        this.logger = logger;
    }


    /**
     * 重写 日志创建
     **/
    @Override
    public Logger create(Class<?> type) {
        return this.logger != null ? this.logger : new FeignLogger();
    }

    @Bean
    Logger.Level feignLoggerLevel() {
        return Logger.Level.FULL;
    }
}
